<?php
require 'Admin/Controller/Controller.php ';
require 'Admin/Model/UserModel.php';
class typeController extends Controller
{
	function __Construct(){
		parent::__Construct();
		$this->model=new UserModel();
	}
	function index()
	{
       $data=$this->model->ctlist();

       //$this->assign('list',$data);
       require_once('admin/view/type/typelist.php');
		//$this->display();  
	}
	function form()
	{
		require_once('admin/view/type/form.php');
	}
	function add()
	{
		$data = $_POST;
		$re=$this->model->addctype($data);
		if ($re) {
			echo '<a href="admin.php?c=type&m=index">添加成功，请返回</a>';
		}
		else
		{
			echo '<a href="admin.php?c=type&m=index">添加失败，请返回</a>';
		}
	}
	function mod()
	{
		$id=$_GET['id'];
		$re=$this->model->getctid($id);
require_once('admin/view/type/mod.php');
	}
	function update(){

       $data=$_POST;
     	var_dump($data);
     	//exit;
     	$result=$this->model->updatectype($data);
     	if ($result)
            {
           	echo "success";
           	echo '<a href=admin.php?c=type&m=index>返回</a>';
           }
        	else
        	{
        			echo "flase";
        			echo '<a href=admin.php?c=type&m=index>返回</a>';
        	}
	}
	function ctdel()
	{
		$id=$_GET['id'];
		$result=$this->model->ctdel($id);
		if ($result)
            {
           	echo "success";
           	echo '<a href=admin.php?c=type&m=index>返回</a>';
           }
        	else
        	{
        			echo "flase";
        			echo '<a href=admin.php?c=type&m=index>返回</a>';
        	}
	}
}
	?>